﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MaterPage/Site.Master" AutoEventWireup="true" CodeBehind="Excel-V2.aspx.cs" Inherits="Js_Study.Excel_Table.Excel_V2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .loading_image {
            background-image: url('/Resource/Images/Loading.gif');
            display: block;
            background-repeat: no-repeat;
            margin-left: 47%;
            margin-top: 29%;
        }
    </style>
    <script src="jquery-framedialog.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="position:fixed;border:1px dashed red;">
        <asp:HiddenField ID="hid" ClientIDMode="Static" runat="server" />
        <asp:Button ID="load_excel" runat="server" Text="Load Excel" OnClick="load_excel_Click" />
        <span runat="server" style="color: red" id="span_status"></span>
        <input type="button" id="render_table" value="Render Table" />
        <input type="button" id="edit_table" value="编辑" />
        <input type="button" id="del_tr" value="删除" />
        <input type="button" id="get_data" value="获取数据" />
    </div>

    <div style="padding-top:35px;">
        <table id="tab" class="tab"></table>
    </div>
    <script>
        var mapData = {
            ID: "编号", CONTINENT: "国家", PROVINCE: "省份", CITY: "城市", CODE: "编码", CREATE_TIME: "创建时间", OP_TIME: "操作时间"
        };

        //{success:1,id:1,data:['11211','中国&美国&日本&韩国','江苏','张家港','Zhangjiagang','2011/2/18 15:00:00','2011/2/18 15:00:00']}
        var tab_model = function (data) {
            this._data = data;

            //data
            this.cells = [];
            this.cellData = [];

            //table
            this.trHead = { tr: [] };
            this.trBody = { trs: [] };

            this.tr = { id: 0, tds: [] };
            this.td = { text: "", color: "black", checkbox: { status: false, tag: "" } };
        }

        tab_model.prototype.fillHead = function () {
            if (this.cells.length == 0) {
                this.analysisData();
            }
            var tr = { tds: [{ text: "", color: "black", checkbox: { status: false, tag: "checkAll" } }] };
            //填充td
            for (var i = 0; i < this.cells.length; i++) {
                tr.tds.push({ text: this.cells[i], color: "black", checkbox: null });
            }
            this.trHead.tr.push(tr);
        }

        tab_model.prototype.fillBody = function () {
            if (this.cellData.length == 0) {
                this.analysisData();
            }
            var data = eval("(" + this.cellData + ")");
            for (var i = 0; i < data.length; i++) {
                var tr = { id: i, tds: [{ text: "", color: "black", checkbox: { status: false, tag: "checkOne" } }] };
                for (var j = 0; j < data[i].data.length; j++) {
                    if (data[i].success == "1") {
                        tr.tds.push({ text: data[i].data[j], color: "red", checkbox: null });
                    }
                    else {
                        tr.tds.push({ text: data[i].data[j], color: "black", checkbox: null });
                    }
                }
                this.trBody.trs.push(tr);
            }
        }

        tab_model.prototype.analysisData = function () {
            this.cells = this._data.split('|')[0].split(',');

            this.cellData = this._data.split('|')[1];
        }

        tab_model.prototype.cells_CN = function (mapData) {
            if (this.cells.length == 0) {
                this.analysisData();
            }
            var mapdataCells = [];

            for (var i in mapData) {
                mapdataCells.push(i);
            }

            var CN_Names = [];
            for (var i = 0; i < this.cells.length; i++) {
                for (var j = 0; j < mapdataCells.length; j++) {
                    if (this.cells[i] == mapdataCells[j]) {
                        CN_Names.push(mapData[mapdataCells[j]]);
                    }
                }
            }
            this.cells = CN_Names;
        }

        var tab_view = function (el) {
            this.el = el;
            this.checkAll = [];
            this.checkboxItem = [];
        }

        tab_view.prototype.appendHeader = function (data) {
            var html = "<tr tag='head'>";
            var data = data;//model.trHead.tr[0].tds;
            for (var i = 0; i < data.length; i++) {
                if (i == 0) {
                    if (data[i].checkbox.status == true) {
                        html += "<td style='color:" + data[i].color + "'><input type='checkbox' tag='" + data[i].checkbox.tag + "' checked='checked' /></td>";
                    }
                    else {
                        html += "<td style='color:" + data[i].color + "'><input type='checkbox' tag='" + data[i].checkbox.tag + "' /></td>";
                    }
                }
                else {
                    html += "<td style='color:" + data[i].color + "'>" + data[i].text + "</td>";
                }
            }
            html += "</tr>";
            $(this.el).append($(html));
            this.checkAll = $(this.el).find("input[type=checkbox][tag=checkAll]");
        }

        tab_view.prototype.appendBody = function (data) {
            var html = "";
            for (var i = 0; i < data.length; i++) {
                html += "<tr tag='body' id='" + data[i].id + "'>";
                for (var j = 0; j < data[i].tds.length; j++) {
                    if (j == 0) {
                        if (data[i].tds[j].checkbox.status == true) {
                            html += "<td style='color:" + data[i].tds[j].color + "'><input type='checkbox' tag='" + data[i].tds[j].checkbox.tag + "' checked='checked' /></td>";
                        }
                        else {
                            html += "<td style='color:" + data[i].tds[j].color + "'><input type='checkbox' tag='" + data[i].tds[j].checkbox.tag + "' /></td>";
                        }
                    }
                    else {
                        html += "<td style='color:" + data[i].tds[j].color + "'>" + data[i].tds[j].text + "</td>";
                    }
                }
                html += "</tr>";
            }

            $(this.el).append($(html));
            this.checkboxItem = $(this.el).find("input[type=checkbox][tag=checkOne]");
        }

        tab_view.prototype.eventCheckBox = function () {
            var items = this.checkboxItem;
            this.checkAll.get(0).addEventListener("click", function () {
                var ck = this.checked;
                for (var i = 0; i < items.length; i++) {
                    items[i].checked = ck;
                }
            }, false);
        }

        tab_view.prototype.delTr = function () {
            var items = this.checkboxItem;
            for (var i = 0; i < items.length; i++) {
                if (items[i].checked) {
                    $(items[i]).parent().parent().remove();
                }
            }
        }

        tab_view.prototype.getTrById = function (id) {
            var tr = null;
            $(this.el).find("tr[tag=body]").each(function () {
                if (this.id == id.toString()) {
                    tr = $(this);
                }
            })
            return tr;
        }

        tab_view.prototype.updateTr = function (trData) {
            var id = trData.id;
            var tds = trData.tds;
            var tr = this.getTrById(id);
            if (tr == null || tr == undefined) {
                return;
            }
            tr.find("input[type=checkbox][tag=checkOne]").get(0).checked = tds[0].checkbox.status;
            tr.find("td").each(function (i) {
                if (i > 0) {
                    $(this).text(tds[i].text);
                }
            })
        }

        var control = function (model, view) {
            this.model = model;
            this.view = view;

            this.init = function () {
                this.model.analysisData();
                this.model.fillHead();
                this.model.fillBody();
            }

            this.render = function () {
                this.view.appendHeader(this.model.trHead.tr[0].tds);

                this.view.appendBody(this.model.trBody.trs);
            }

            this.tabEvent = function () {
                this.view.eventCheckBox();
            }

            this.setLanguage = function () {
                this.model.cells_CN(mapData);
            }

            this.del = function () {
                this.view.delTr();
            }

            this.getData = function () {
                var html = "";

                $(this.view.el).find("tr[tag=body]").each(function () {
                    html += "{id:" + this.id + ",data:["

                    $(this).find("td").each(function () {
                        if ($(this).children().length == 0) {
                            html += "'" + $(this).text() + "',";
                        }
                    })
                    html = html.substring(0, html.length - 1);
                    html += "]},";
                })
                html = html.substring(0, html.length - 1);

                return html;
            }

            this.edit = function () {
                var val = "";
                var id = "";
                var types = "";
                var cells = "";
                $(this.view.el).find("input[type=checkbox][tag=checkOne]").each(function () {
                    if (this.checked) {
                        var tr = $(this).parent().parent();
                        id = tr.attr("id");
                        tr.find("td").each(function () {
                            if ($(this).children().length == 0) {
                                val += "'" + $(this).text() + "',";
                            }
                        })
                    }
                })

                for (var i = 0; i < this.model.cells.length; i++) {
                    cells += "'" + this.model.cells[i] + "',";
                }
                cells = cells.substring(0, cells.length - 1);
                val = val.substring(0, val.length - 1);
                return "{id:" + id + ",cells:[" + cells + "],val:[" + val + "]}";
            }

            this.updateOldData = function (tr) {
                if (tr == null || tr == undefined) {
                    return;
                }
                this.view.updateTr(tr);
            }
        }

        //test data.
        //var data = "ID,CONTINENT,PROVINCE,CITY,CODE,CREATE_TIME,OP_TIME|[{success:1,data:['11211','中国','江苏','张家港','Zhangjiagang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11212','中国','江苏','镇江','Zhenjiang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11213','中国','江苏','周庄','Zhouzhuang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11215','中国','江西','德兴','Dexing','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11217','中国','江西','吉安','Jian','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11221','中国','江西','庐山','Lushan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11223','中国','江西','萍乡','Pingxiang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11224','中国','江西','三清山','Sanqingshan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11225','中国','江西','上饶','Shangrao','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11226','中国','江西','婺源','Wuyuan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11227','中国','江西','新余','Xinyu','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11228','中国','江西','宜春','Yichun','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11229','中国','江西','鹰潭','Yingtang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11230','中国','辽宁','鞍山','Anshan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11231','中国','辽宁','本溪','Benxi','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11233','中国','辽宁','抚顺','Fushun','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['825','中国','山东','济宁','JNG','2011/2/17 11:24:00','2011/2/17 11:24:00']},{success:0,data:['11003','中国','','中山','Zhongshan','2011/2/17 18:47:00','2011/2/17 18:47:00']},{success:0,data:['11005','中国','','佛山','Foshan','2011/2/17 18:47:00','2011/2/17 18:47:00']},{success:0,data:['11013','中国','','苏州','Suzhou','2011/2/17 18:47:00','2011/2/17 18:47:00']},{success:1,data:['11234','中国','辽宁','葫芦岛','Huludao','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11236','中国','辽宁','辽阳','Liaoyang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11237','中国','辽宁','盘锦','Panjin','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11238','中国','辽宁','铁岭','Tieling','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11239','中国','辽宁','营口','Yingkou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11241','中国','内蒙古自治区','巴彦淖尔','Bayannaoer','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11245','中国','内蒙古自治区','呼伦贝尔市','Hulunbeier','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11246','中国','内蒙古自治区','满洲里','Manzhouli','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11249','中国','山东','滨州','Binzhou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11250','中国','山东','博兴','Boxing','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11251','中国','山东','德州','Dezhou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11253','中国','山东','肥城','Feicheng','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11254','中国','山东','菏泽','Heze','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11255','中国','山东','即墨','Jimo','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11257','中国','山东','胶南','Jiaonan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11258','中国','山东','莱芜','Laiwu','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11259','中国','山东','莱西','Laixi','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11260','中国','山东','聊城','Liaocheng','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11262','中国','山东','龙口','Longkou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11263','中国','山东','蓬莱','Penglai','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11264','中国','山东','平度','Pingdu','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11265','中国','山东','平邑','Pingyi','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11266','中国','山东','青州','Qingzhou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11267','中国','山东','曲阜','Qufu','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11268','中国','山东','日照','Rizhao','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11269','中国','山东','荣成','Rongcheng','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11270','中国','山东','寿光','Shouguang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11271','中国','山东','泰安','Taian','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11274','中国','山东','文登','Wendeng','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11275','中国','山东','夏津','Xiajin','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11277','中国','山东','兖州','Yanzhou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11278','中国','山东','枣庄','Zaozhuang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11279','中国','山东','淄博','Zibo','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11281','中国','山西','介休','Jiexiu','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11282','中国','山西','晋城','Jincheng','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11283','中国','山西','晋中','Jinzhong','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11284','中国','山西','临汾','Linfen','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11285','中国','山西','平定县','Pingdingxian','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11286','中国','山西','平遥','Pingyao','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11287','中国','山西','五台山','Wutaishan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11288','中国','山西','阳城县','Yangchengxian','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11289','中国','山西','阳泉','Yangquan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11292','中国','陕西','宝鸡','Baoji','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11294','中国','陕西','华山','Huashan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11295','中国','陕西','神木县','Shenmuxian','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11296','中国','陕西','铜川','Tongchuan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11297','中国','陕西','咸阳','Xianyang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11300','中国','四川','北川县','Beichuanxian','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11301','中国','四川','达州','Dazhou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11302','中国','四川','大英','Daying','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11303','中国','四川','稻城','Daocheng','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11304','中国','四川','德阳','Deyang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11305','中国','四川','都江堰','Dujiangyan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11306','中国','四川','峨眉山','Emeishan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11307','中国','四川','广安','Guangan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11309','中国','四川','海螺沟','Hailuogou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11310','中国','四川','江油','Jiangyou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11312','中国','四川','康定','Kanding','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11313','中国','四川','阆中','Langzhong','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11314','中国','四川','乐山','Leshan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11315','中国','四川','凉山州','Liangshanzhou','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11316','中国','四川','泸定','Luding','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11318','中国','四川','马尔康','Maerkang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11319','中国','四川','眉山','Meishan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11321','中国','四川','内江','Neijiang','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11324','中国','四川','邛崃','Qionglai','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11325','中国','四川','遂宁','Suining','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11327','中国','四川','雅安','Yaan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11329','中国','四川','自贡','Zigong','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11330','中国','西藏自治区','阿里','Alishi','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['11332','中国','新疆自治区','喀纳斯','Kanasi','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11336','中国','新疆自治区','吐鲁番','Tulufan','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11339','中国','云南','楚雄','Chuxiong','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11341','中国','云南','德钦','Deqin','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:0,data:['11342','中国','云南','建水','Jianshui','2011/2/18 15:00:00','2011/2/18 15:00:00']},{success:1,data:['571','北美','美国','德梅因','DSM','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['573','北美','美国','多森','DHN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['574','北美','美国','迪比克','DBQ','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['575','北美','美国','德卢斯','DLH','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['576','北美','美国','欧克莱尔','EAU','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['577','北美','美国','伊利','ERI','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['578','北美','美国','华盛顿(里根国家机场)','DCA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['579','北美','美国','华盛顿(杜累斯机场)','IAD','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['580','北美','美国','滑铁卢','ALO','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['581','北美','美国','沃特敦','ATY','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['582','北美','美国','莫西尼','CWA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['583','北美','美国','西棕榈滩','PBI','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['584','北美','美国','怀特普莱恩斯','HPN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['585','北美','美国','韦斯特切斯特','HPN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['586','北美','美国','威奇塔福尔斯','ICT','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['587','北美','美国','沙伦(宾夕法尼亚州)','YNG','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['588','北美','美国','沃伦(俄亥俄州)','YNG','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['589','北美','美国','扬斯敦','YNG','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['590','北美','美国','埃斯卡纳巴','ESC','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['591','北美','美国','埃文斯维尔','EVV','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['592','北美','美国','法戈','FAR','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['593','北美','美国','费耶特维尔','FYV','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['594','北美','美国','弗林特','FNT','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['595','北美','美国','道奇堡','FOD','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['596','北美','美国','劳德尔堡','FLL','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['597','北美','美国','史密斯堡','FSM','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['598','北美','美国','埃格林空军基地','VPS','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['599','北美','美国','韦恩堡','FWA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['600','北美','美国','大福克斯','GFK','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['601','北美','美国','大急流(明尼苏达州)','GPZ','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['602','北美','美国','大急流(密执安州)','GRR','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['603','北美','美国','格林贝','GRB','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['604','北美','美国','格林维尔(密西西比州)','GLH','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['605','北美','美国','格林维尔(南卡罗莱纳州)','GSP','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['606','北美','美国','格尔夫波特','GPT','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['607','北美','美国','汉考克','CMX','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['610','北美','美国','西宾/奇瑟姆','HIB','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['612','北美','美国','阿什兰','HTS','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['613','北美','美国','亨茨维尔','HSV','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['614','北美','美国','海恩尼斯','HYA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['615','北美','美国','印第安纳波利斯','IND','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['616','北美','美国','国际瀑布','INL','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['617','北美','美国','杰克逊(密西西比州)','JAN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['618','北美','美国','杰克逊(田纳西州)','MKL','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['619','北美','美国','杰克逊维尔','JAX','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['620','北美','美国','乔普林','JLN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['621','北美','美国','卡拉马祖','AZO','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['623','北美','美国','诺克斯维尔','TYS','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['624','北美','美国','拉克鲁斯','LSE','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['625','北美','美国','拉斐特','LAF','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['626','北美','美国','兰辛','LAN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['628','北美','美国','汉诺威/莱巴嫩','LEB','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['629','北美','美国','普雷斯克岛','PQI','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['630','北美','美国','列克星敦','LEX','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['631','北美','美国','林肯','LNK','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['632','北美','美国','小石城','LIT','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['633','北美','美国','路易斯维尔','SDF','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['634','北美','美国','麦迪逊','MSN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['635','北美','美国','曼彻斯特','MHT','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['636','北美','美国','马凯特','MQT','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['637','北美','美国','梅森城','MCW','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['638','北美','美国','孟菲斯','MEM','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['639','北美','美国','默里迪恩','MEI','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['640','北美','美国','迈阿密','MIA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['641','北美','美国','密尔沃基','MKE','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['642','北美','美国','明尼阿波利斯','MSP','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['643','北美','美国','迈诺特','MOT','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['644','北美','美国','莫比尔','MOB','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['645','北美','美国','莫林','MLI','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['646','北美','美国','门罗','MLU','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['647','北美','美国','蒙哥马利','MGM','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['648','北美','美国','佛罗伦萨/设菲尔德','MSL','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['649','北美','美国','马斯基根','MKG','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['650','北美','美国','楠塔基特','ACK','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['651','北美','美国','诺什维尔','BNA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['652','北美','美国','新奥尔良','MSY','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['653','北美','美国','纽瓦克','EWR','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['654','北美','美国','艾斯利普','ISP','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['655','北美','美国','纽约(肯尼迪机场)','JFK','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['656','北美','美国','纽约(拉瓜迪亚机场)','LGA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['657','北美','美国','诺福克','ORF','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['658','北美','美国','俄克拉何马城','OKC','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['659','北美','美国','奥马哈','OMA','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['661','北美','美国','欧文斯伯勒','OWB','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['662','北美','美国','啪迪尤卡','PAH','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:1,data:['663','北美','美国','巴拿马城(美)','PFN','2010/12/23 14:28:00','2010/12/23 14:28:00']},{success:0,data:['664','北美','美国','佩尔斯顿','PLN','2010/12/23 14:28:00','2010/12/23 14:28:00']}]";

        var m = new tab_model($("#hid").val());
        var v = new tab_view($("#tab"));
        var c = new control(m, v);
        $("#render_table").click(function () {
            if ($("#hid").val() == "") {
                alert("请先载入Excel数据.");
                return;
            }
            c.init();
            c.setLanguage();
            c.render();
            c.tabEvent(m);
        })

        $("#del_tr").click(function () {
            c.del();
        })

        $("#get_data").click(function () {
            alert(c.getData());
        })

        var fid = null;
        $("#edit_table").click(function () {
            var count = 0;
            $(c.view.el).find("input[type=checkbox][tag=checkOne]").each(function () {
                if (this.checked) {
                    count++;
                }
            })

            if (count != 1) {
                alert("请选择一项进行编辑!");
                return;
            }

            var a = c.edit();
            var url = "edit.html?args=" + encodeURI(encodeURI(a)) + "&ran=" + Math.random();
            fid = $.FrameDialog
                .create({ draggable: false, url: url, width: 630, height: 480, title: 'Update Information!', loadingClass: 'loading_image' })
                .bind("dialogclose", function (e) {
                    var result = e.result;
                    c.updateOldData(result);
                })
        })
    </script>
</asp:Content>
